<!--
* description: 文本输入框通用组件
* author: luojx
* createdDate: 2019-07-30
*  2019-08-09 修改文字溢出效果-封装/校验效果 liyanm
*  2019-08-15 增加输入框类型判断，默认text   yinxy
*  2019-10-09 增加密码框 ,默认 password lixb
-->
<template>
  <el-col v-show="curIsShow" :key="fullComponentKey" :span="span">
    <lableName
      :validrule="validrule"
      :cur-label-name="curLabelName"
      :is-show-label="isShowLabel"
      :is-require="isRequire"
      :curis-func="curisFunc"
      :max-word-count="dataToObject==null ? 6 :dataToObject.maxWordCount"
      :label-width="labelWidth"
      @clickEvent="sendLabelCode"
    />
    <el-input
      v-show="curIsShowComp"
      v-model="modelCode"
      :placeholder="placeholder"
      :disabled="curDisabled"
      :readonly="readonly"
      size="small"
      :maxlength="dataToObject==null ? null :dataToObject.maxLength"
      :suffix-icon="suffixIcon"
      :rows="2"
      :clearable="clearable"
      type="textarea"
      :style="{'width': (labelWidth !== 80 ? `calc(100% - ${labelWidth}px)`: '')}"
      @clear="clearCode"
      @change="sendCode"
      @input="inputCode"
      @blur="inputBlur"
    />
    <span v-show="!curIsShowComp" @click="showCompByClick(true)">{{ modelCode }}</span>
    <validateFormate :cur-label-name="curLabelName" :validrule="validrule" />
  </el-col>
</template>
<script>
import { inputMixins } from '@/components/mixins/inputMixins'
// import lableName from "@/components/lableName";
// import validateFormate from "@/components/validateFormate";
export default {
  components: {
    lableName: () => import('@/components/lableName'), // 标题溢出样式组件
    validateFormate: () => import('@/components/validateFormate') // 校验提示样式组件
  },
  mixins: [inputMixins],
  props: {
    showPlaceholder: { type: String, default: null }
  },
  data() {
    return {
      placeholder:
        this.showPlaceholder === null
          ? this.$t('sys.tips.esTip13')
          : this.showPlaceholder
    }
  },
  watch: {
    'curDisabled': {
      handler(disabled) {
        disabled ? this.placeholder = '' : this.placeholder = this.$t('sys.tips.esTip13')
      }
    }
  },
  mounted() {
    this.curDisabled ? this.placeholder = '' : this.placeholder = this.$t('sys.tips.esTip13')
  }
}
</script>
